2accabf0b04db16734d5eeab02fd882abe3c608d,extensions-core/src/main/java/org/thingsboard/server/extensions/core/plugin/telemetry/handlers/TelemetryRestMsgHandler.java,TelemetryRestMsgHandler,handleHttpGetRequest,#PluginContext#PluginRestMsg#,50

Before Change


                } else if (entity.equals("attributes")) {
                    List<AttributeKvEntry> attributes;
                    if (!StringUtils.isEmpty(scope)) {
                        attributes = ctx.loadAttributes(deviceId, scope);
                    } else {
                        attributes = new ArrayList<>();
                        Arrays.stream(DataConstants.ALL_SCOPES).forEach(s -> attributes.addAll(ctx.loadAttributes(deviceId, s)));
                    }
                    List<String> keys = attributes.stream().map(attrKv -> attrKv.getKey()).collect(Collectors.toList());
                    msg.getResponseHolder().setResult(new ResponseEntity<>(keys, HttpStatus.OK));
                }
            } else if (method.equals("values")) {
                if ("timeseries".equals(entity)) {
                    String keys = request.getParameter("keys");
                    Optional<Long> startTs = request.getLongParamValue("startTs");
                    Optional<Long> endTs = request.getLongParamValue("endTs");
                    Optional<Integer> limit = request.getIntParamValue("limit");
                    Map<String, List<TsData>> data = new LinkedHashMap<>();
                    for (String key : keys.split(",")) {
                        //TODO: refactoring
//                        List<TsKvEntry> entries = ctx.loadTimeseries(deviceId, new BaseTsKvQuery(key, startTs, endTs, limit));
//                        data.put(key, entries.stream().map(v -> new TsData(v.getTs(), v.getValueAsString())).collect(Collectors.toList()));
                    }
                    msg.getResponseHolder().setResult(new ResponseEntity<>(data, HttpStatus.OK));
                } else if ("attributes".equals(entity)) {
                    String keys = request.getParameter("keys", "");
                    List<AttributeKvEntry> attributes;
                    if (!StringUtils.isEmpty(scope)) {
                        attributes = getAttributeKvEntries(ctx, scope, deviceId, keys);
                    } else {
                        attributes = new ArrayList<>();
                        Arrays.stream(DataConstants.ALL_SCOPES).forEach(s -> attributes.addAll(getAttributeKvEntries(ctx, s, deviceId, keys)));
                    }
                    List<AttributeData> values = attributes.stream().map(attribute -> new AttributeData(attribute.getLastUpdateTs(),
                            attribute.getKey(), attribute.getValue())).collect(Collectors.toList());

After Change


                            List<String> keyList = Arrays.asList(keys.split(","));
                            ctx.loadAttributes(deviceId, scope, keyList, callback);
                        } else {
                            ctx.loadAttributes(deviceId, scope, callback);
                        }
                    } else {
                        if (!StringUtils.isEmpty(keys)) {
                            List<String> keyList = Arrays.asList(keys.split(","));
                            ctx.loadAttributes(deviceId, Arrays.asList(DataConstants.ALL_SCOPES), keyList, callback);
                        } else {
                            ctx.loadAttributes(deviceId, Arrays.asList(DataConstants.ALL_SCOPES), callback);
                        }